<!-- Content Header (Page header) -->
<section class="content-header">
	<h1>Zookeeper信息</h1>
	<ol class="breadcrumb">
		<li><a href="#"><i class="fa fa-dashboard"></i>Zookeeper信息</a></li>
		<li><a href="#"></i>Zookeeper信息</a></li>
	</ol>
</section>
<!-- Main content -->
<section id="container" class="content">
	<div class="row">
		<div class="col-md-12">
			<div class="box box-primary">

				<div class="box-header">
				 <form action="" id="query_Form">
					<select onchange="datasouce_change()" name="ds" id="datasource" class="form-control" style="width: 200px;">
		                  	<option value="">请选择注册中心</option>
		                  	<option value="mycat">mycat</option>
		            </select>
		         </form>
				</div>
				<div class="box-body">
					<div>
						<table id="table"></table>
						<div style="text-align: right;">
							<div id="paginator"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
</section>
<!-- /.content -->


<script type="text/javascript">
   $.AdminLTE.boxWidget.activate();
</script>
<Script language="javascript">
function GetRequest() {
  
  var url = location.search; //获取url中"?"符后的字串
   var theRequest = new Object();
   if (url.indexOf("?") != -1) {
      var str = url.substr(1);
      strs = str.split("&");
      for(var i = 0; i < strs.length; i ++) {
         theRequest[strs[i].split("=")[0]]=(strs[i].split("=")[1]);
      }
   }
   return theRequest;
}
</Script>
<script type="text/javascript">

var datasouce_change = function(){
	queryForm('query_Form');
}

var Selected_Callback = function(target_select){
	  this.onSuccess=function(data){
			try {
				var j_obj = data;
				if (j_obj.success) {
					var length = j_obj.rows.length;
					for(var i=0;i<length;i++){
						var mycatName = j_obj.rows[i].cluster;
						$("#"+target_select).append("<option value=\""+ mycatName+"\">"+ mycatName+"</option>");
					}
				}
			} catch (e) {
				alert("异常!")
			}
		};
		this.onFail = function(jqXHR, textStatus, errorThrown){
		};
};

var initDataSouce = function(){
	var Request = new Object();
	Request = GetRequest();
	var path;
	path = Request['path'];
	var rainbow = new Rainbow();
	rainbow.setService("zkConfigService");
	rainbow.setMethod("query");
	rainbow.setParam("path", path);
	//rainbowAjax.query(rainbow, new Selected_Callback("datasource"));
};


$(document).ready(function() {
	initDataSouce();
		    var cols = [
					{ title:'Path', name:'Path' ,width:400, align:'left'},
			        { title:'Data', name:'Data' ,width:600, align:'left'}
			        
			    ];
	  mmgrid = $('#table').mmGrid({
	        indexCol: true,
	        height: '400',
	        indexColWidth: 35,
	        cols: cols,
	        url: './dispatcherAction/queryByMMGrid.do?service=zkConfigService&method=getZkconfig',
	        method: 'post',
	        root: 'items'
	    });
});
  
</script>
